import Notify from '@/vant/notify/notify'
import Dialog from '@/vant/dialog/dialog'

export const showErrorNotify = (tips: string) => {
  Notify({ message: tips, color: '#ffffff', background: '#ed3f14' })
}
export const showSuccessNotify = (tips: string) => {
  Notify({ message: tips, color: '#ffffff', background: '#19be6b' })
}
type YesOrNo = 'yes' | 'no'
export const showConfirmDialog = (
  title: string,
  message: string
): Promise<YesOrNo> => {
  return new Promise((resolve: (p: YesOrNo) => void) => {
    Dialog.confirm({
      title,
      message,
    })
      .then(() => {
        resolve('yes')
      })
      .catch(() => {
        resolve('no')
      })
  })
}
